import { GameData } from "./GameData";
import { TaskMgr } from "./TaskMgr";

cc.Class({
    extends: cc.Component,

    properties: {
        
    },

    init(num){
        this.node.opacity = 255;
        let action = cc.sequence(
            cc.delayTime(1),
            cc.fadeOut(1),
            cc.callFunc(()=>{
                GameData.addCoin(num);
                TaskMgr.addDaliyTask(2,num,true);
                let node = G.utils.getPoolNode('nodePoolCoin');
                node.parent = this.node.parent;
                node.position = this.node.position;
                node.getComponent('ItemCoin').init(num);
                G.utils.putPoolNode('nodePoolPoop',this.node);
            })
        )
        this.node.runAction(action);
    },

});
